<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <h:head>
        <title>Tournée | Care@Home</title>
        <script src="http://maps.google.com/maps/api/js?sensor=false"
        type="text/javascript"></script>
        <style type="text/css">
            body {
                background-color: #d2caec;
            }

            .center {
                text-align: center;
            }

            #centerMap {
                margin-left: auto;
                margin-right: auto;
                width: 600px;
            }

            #mapDiag {
                margin-top: 100px;
                margin-left: auto;
                margin-right: auto;
                width: 150px;
            }

            #sep {
                text-align: center;
            }
        </style>
    </h:head>

    <h:body>
        <p:layout fullPage="true">
            <!-- BANNER -->
            <p:layoutUnit styleClass="include" position="north" id="menu">
                <ui:include src="../basic/banner.xhtml" />
            </p:layoutUnit>
            <!-- MENU -->
            <p:layoutUnit styleClass="include" position="west">
                <ui:include src="../basic/menu.xhtml" />
            </p:layoutUnit>
            <!-- CONTENT -->
            <p:layoutUnit styleClass="include" position="center">
                <h:form>
                    <div id="mapDiag">
                        <p:commandButton type="button" icon="ui-icon-pin-s"
                                         value="GoogleMap" onclick="dlg.show()" style="width:150px;" />
                    </div>

                    <br />

                    <h:form>

                        <p:dataTable id="dataTable" var="user" value="#{mapBean.users}">
                            <f:facet name="header">  
                                Liste des adresses 
                            </f:facet>

                            <p:column sortBy="#{user.firstName}" headerText="Nom">
                                <h:outputText value="#{user.firstName}" />
                            </p:column>
                            <p:column sortBy="#{user.lastName}" headerText="Prénom">
                                <h:outputText value="#{user.lastName}" />
                            </p:column>
                            <p:column sortBy="#{user.address}" headerText="Adresse">
                                <h:outputText value="#{user.address}" />
                            </p:column>
                            <p:column sortBy="#{user.phone}" headerText="Tel">
                                <h:outputText value="#{user.phone}" />
                            </p:column>
                        </p:dataTable>

                    </h:form>

                </h:form>
            </p:layoutUnit>
        </p:layout>

        <!-- put here for fix a bug (unclosable map windows)  -->
        <p:dialog widgetVar="dlg" width="625" height="400" modal="true">
            <p:growl id="growl" showDetail="true" />

            <p:gmap center="#{mapBean.lat},#{mapBean.lon}"
                    zoom="#{mapBean.zoom}" type="HYBRID"
                    model="#{mapBean.simpleModel}" style="width:600px;height:400px">
                <p:ajax event="overlaySelect" listener="#{mapBean.onMarkerSelect}"
                        update="growl" />
            </p:gmap>
        </p:dialog>

    </h:body>
</html>

